* Do not check master lag
* check just thread counts on SHOW STATUS, less bits on wire, less rows to handle for php
/**
* Get status information from SHOW STATUS in an associative array
*/
- function getStatus() {
- $res = $this->query( 'SHOW STATUS' );
+ function getStatus($which="%") {
+ $res = $this->query( "SHOW STATUS LIKE '{$which}'" );
$status = array();
while ( $row = $this->fetchObject( $res ) ) {
$status[$row->Variable_name] = $row->Value;
function getLag() {
return false;
}
- function getStatus() {
+ function getStatus($which=null) {
$result = array('Threads_running' => 0, 'Threads_connected' => 0);
return $result;
}
unset( $loads[$i] );
$sleepTime = 0;
} else {
- $status = $this->mConnections[$i]->getStatus();
+ $status = $this->mConnections[$i]->getStatus("Thread%");
if ( isset( $this->mServers[$i]['max threads'] ) &&
$status['Threads_running'] > $this->mServers[$i]['max threads'] )
{
$times = array();
foreach ( $this->mServers as $i => $conn ) {
- if ( $this->openConnection( $i ) ) {
+ if ($i==0) { # Master
+ $times[$i] = 0;
+ } elseif ( $this->openConnection( $i ) ) {
$times[$i] = $this->mConnections[$i]->getLag();
}
}